package com.jsh.erp.api;


import com.jsh.erp.constants.BusinessConstants;
import com.jsh.erp.datasource.entities.DepotHead;
import com.jsh.erp.datasource.entities.DepotHeadExample;
import com.jsh.erp.exception.JshException;
import com.jsh.erp.service.depotHead.DepotHeadService;
import com.jsh.erp.utils.StringUtil;
import com.jsh.erp.utils.Tools;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataAccessException;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

@RestController
@RequestMapping("/remote/api/depotHead")
public class DepotHeadRemote {

    @Autowired
    private DepotHeadService depotHeadService;

    @GetMapping("/getAccountSum")
  public   BigDecimal getAccountSum(@RequestParam("id")Long id,
                             @RequestParam("timeStr") String timeStr,
                             @RequestParam("type")String type) throws Exception{
        return depotHeadService.getAccountSum(id, timeStr, type);
    }
    @GetMapping("/getManyAccountSum")
   public BigDecimal getManyAccountSum(@RequestParam("id")Long id,
                                 @RequestParam("timeStr") String timeStr,
                                 @RequestParam("type")String type)throws Exception{
        return depotHeadService.getManyAccountSum(id, timeStr, type);    }
    @GetMapping("/getDepotHeadListByAccountIds")
   public List<DepotHead> getDepotHeadListByAccountIds(@RequestParam("accountIds") String[] accountIds){
        return depotHeadService.getDepotHeadListByAccountIds(accountIds);
    }

    @GetMapping("/getDepotHead")
    DepotHead getDepotHead(@RequestParam("number")String number)throws Exception{
        return depotHeadService.getDepotHead(number);
    }
}
